#import "RootWebViewController.h"
#import <YYKit.h>
@interface RootWebViewController ()<WKNavigationDelegate>
@property (nonatomic,assign) double lastProgress;
@end
@implementation RootWebViewController
- (void)viewDidLoad {
    [super viewDidLoad];
    _isShowCloseBtn = YES;
}
-(void)updateNavigationItems{
    if (_isShowCloseBtn) {
        if (self.webView.canGoBack) {
            self.navigationController.interactivePopGestureRecognizer.enabled = NO;
            [self addNavigationItemWithImageNames:@[@"nav_back",ASLocalizedString(@"关闭")] isLeft:YES target:self action:@selector(leftBtnClick:) tags:@[@2000,@2001]];
        }else{
            self.navigationController.interactivePopGestureRecognizer.enabled = YES;
            if (kiOS9Later) {
                [self addNavigationItemWithImageNames:@[@"nav_back"] isLeft:YES target:self action:@selector(leftBtnClick:) tags:@[@2001]];
            }
        }
    }
}
-(void)leftBtnClick:(UIButton *)btn{
    switch (btn.tag) {
        case 2000:
            [super backBtnClicked];
            break;
        case 2001:
        {
            if (self.presentingViewController) {
                [self dismissViewControllerAnimated:YES completion:nil];
            }else{
                [self.navigationController popViewControllerAnimated:YES];
            }
        }
            break;
        default:
            break;
    }
}
-(void)dealloc{
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    self.tabBarController.tabBar.translucent = YES;
    self.tabBarController.tabBar.hidden = YES;
    [self.navigationController setNavigationBarHidden:NO animated:animated];
}
- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    self.tabBarController.tabBar.hidden = NO;
    self.tabBarController.tabBar.translucent = NO;
    [self.navigationController setNavigationBarHidden:NO animated:animated];
}
@end
